/**
 * UNIVERSIDADE FEDERAL DO RIO GRANDE DO NORTE - UFRN
 * DEPARTAMENTO DE INFORMATICA E MATEMATICA APLICADA - DIMAP
 * Programa de Pos-Graduacao em Sistemas e Computacao - PPGSC
 */
package br.ufrn.spl.ev.engines.conflicts.indirect;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jdt.core.IJavaProject;

import br.ufrn.spl.ev.engines.miners.svn.SVNConnector;
import br.ufrn.spl.ev.models.changeloghistorymodel.AssetChangeLog;
import br.ufrn.spl.ev.models.changeloghistorymodel.ChangeLogHistory;
import br.ufrn.spl.ev.models.changeloghistorymodel.ClassChangeLog;
import br.ufrn.spl.ev.models.changeloghistorymodel.MethodChangeLog;

/**
 *  <p>A mock object to the de indirect conflict detection<p>
 *
 * @author jadson - jadson@info.ufrn.br
 * @vesion 1.0 - Class Creation.
 * @since 15/10/2013
 *
 */
public class IndirectConflictsDetectionMockStrategy  extends IndirectConflictsDetectionStrategy{

	
	/**
	 * 
	 * @see br.ufrn.spl.ev.engines.conflicts.indirect.IndirectConflictsDetectionStrategy#loadData(br.ufrn.spl.ev.models.changeloghistorymodel.ChangeLogHistory, br.ufrn.spl.ev.models.changeloghistorymodel.ChangeLogHistory, java.lang.String, java.lang.String)
	 */
	@Override
	protected void loadData(ChangeLogHistory changeLogHistorySource, ChangeLogHistory changeLogHistoryTarget, SVNConnector sourceConnector, SVNConnector targetConnector) {
		this.changeLogHistorySource = changeLogHistorySource;
		this.changeLogHistoryTarget = changeLogHistoryTarget;
		
	}
	

	/**
	 * Mock implementation: Doesn't find the real dependence on some project, makes the asset dependences for "ABC" example (a very simple example for tests) 
	 * 
	 * @see br.ufrn.spl.ev.engines.conflicts.indirect.IndirectConflictsDetectionStrategy#getDependenceOfAsset(br.ufrn.spl.ev.models.changeloghistorymodel.AssetChangeLog)
	 */
	@Override
	protected List<AssetChangeLog> getDependenceOfAsset(IJavaProject javaProject, AssetChangeLog assetChangeLog) {
		
		List<AssetChangeLog> depedences = new ArrayList<AssetChangeLog>();
		
		/* ***********************************************************************
		 *  Factory of dependences for test
		 *  The more important here is the signature of assets, for we can compare them.
		 * ***********************************************************************/
		
		/*
		 * b1 that has not direct conflict depend of "e1" that change on target too, so how "b1" has indirect conflict
		 * 
		 * @see{IprojectMinerMock}
		 */
		if(assetChangeLog.getName().equals("b1") ){
			MethodChangeLog method = new MethodChangeLog("e1", "double#e1(double)", null);
			method.setClassChangeLog(new ClassChangeLog("E.java", "Target/src/exemple/E.java", "src/exemple/E.java", null, null));
			depedences.add( method );
		}
		
		/*
		 * d1 that has not direct conflict depend of "notExistMethod" that is not present on target, so how "d1" has no indirect conflict
		 * 
		 * @see{IprojectMinerMock}
		 */
		if(assetChangeLog.getName().equals("d1") ){
			MethodChangeLog method = new MethodChangeLog("notExistMethod", "void#notExistMethod()", null);
			method.setClassChangeLog(new ClassChangeLog("NotExistClass.java", "Target/src/exemple/NotExistClass.java", "src/exemple/NotExistClass.java", null, null));
			depedences.add( method );
		}
		
		return depedences;
		
	}


	
}
